<?php

namespace app\middleware;


class JumpLogin
{
    public function handle($request, \Closure $next, $doing='redirect')
    {
        if (cookie('token') == '') {
            if ($doing == 'json') {
                return json(['code'=>-1,'msg'=>'请先登录']);
            } else {
                return redirect('/auth/login');
            }
        }

        return $next($request);
    }
}